<!DOCTYPE html>

<html>
<head>
  <style>
    * {
      margin: 0;
    }
    #container {
      position: relative;
      height: 300px;
      width: 300px;
      margin: 10px;
      background-color: green;
      opacity: 0.5;
      transition-property: opacity;
      transition-timing-function: linear;
      transition-duration: 5s;
    }

    #box {
      position: absolute;
      left: 10px;
      top: 10px;
      height: 200px;
      width: 200px;
      background-color: blue;
    }

    #indicator {
      position: absolute;
      top: 150px;
      left: 150px;
      height: 100px;
      width: 100px;
      background-color: orange;
      z-index: -1;
    }
  </style>
  <script>
    if (window.testRunner)
      testRunner.waitUntilDone();

    function waitForCompositor() {
      var box = document.getElementById('box');
      return box.animate({transform: ['scale(1)', 'scale(1)']}, 1).ready;
    }

    function runTest()
    {
      var container = document.getElementById('container');
      container.style.opacity = 1;
      
      // dump the tree in the middle of the transition
      if (window.internals) {
          internals.forceCompositingUpdate(document);
          internals.pauseAnimations(2.5);
      }
      if (window.testRunner) {
        waitForCompositor().then(() => {
          testRunner.notifyDone();
        });
      }
    }
    // FIXME: this should use runTransitionTest().
    window.addEventListener('load', runTest, false);
  </script>
</head>
<body>

  <div id="container">
    <div id="box"></div>
    <div id="indicator"></div>
  </div>

</body>
</html>
